<?php namespace OAuth2\Server;

/**
 * OAuth2.0 draft v10 exception handling.
 *
 * @author Originally written by Naitik Shah <naitik@facebook.com>.
 * @author Update to draft v10 by Edison Wong <hswong3i@pantarei-design.com>.
 *
 * @sa <a href="https://github.com/facebook/php-sdk">Facebook PHP SDK</a>.
 */
class Exception extends \Exception {

  protected $_httpStatusCode;
  protected $_error;
  protected $_errorDescription;
  protected $_error_uri;

  /**
   * Make a new API Exception with the given result.
   *
   * @param $result
   *   The result from the API server.
   */
  public function __construct($httpStatusCode, $error, $errorDescription = NULL, $errorUri = NULL) 
  {
    $this->_httpStatusCode = $httpStatusCode;
    $this->_error = $error;
    $this->_errorDescription = $errorDescription;
    $this->_errorUri = $errorUri;
    parent::__construct($errorDescription);
  }

  /**
   * httpStatusCode getter
   *
   * @returns string
   */
  public function getHttpStatusCode() 
  {
    return $this->_httpStatusCode;
  }
  
  /**
   * _errorUri getter
   *
   * @returns string
   */
  public function getErrorUri() 
  {
    return $this->_errorUri;
  }
  
  public function getError() 
  {
      return $this->_error;
   }

    public function setError($error)
    {
        $this->_error = $error;
    }
}
